package xyz.xtt.asset.client;

import java.math.BigDecimal;
import java.util.Collection;
import java.util.List;
import java.util.Map;

import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import cn.hutool.json.JSONUtil;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
import lombok.extern.slf4j.Slf4j;
import xyz.xtt.asset.api.enums.AssetTypeEnum;
import xyz.xtt.asset.client.request.AssetNoInfoRequest;
import xyz.xtt.asset.client.request.CancelTransactionRequest;
import xyz.xtt.asset.client.request.CardInfoRequest;
import xyz.xtt.asset.client.request.ConfirmTransactionRequest;
import xyz.xtt.asset.client.request.DeliverRequest;
import xyz.xtt.asset.client.request.MakeTransactionRequest;
import xyz.xtt.asset.client.request.MintRequest;
import xyz.xtt.asset.client.request.ThirdOrderRequest;
import xyz.xtt.asset.client.request.TransferFromRequest;
import xyz.xtt.asset.client.response.AssetAccountResponse;
import xyz.xtt.asset.client.response.AssetAllInfoResponse;
import xyz.xtt.asset.client.response.AssetDetailInfo;
import xyz.xtt.asset.client.response.AssetExtInfoResponse;
import xyz.xtt.asset.client.response.AssetGroupResponse;
import xyz.xtt.asset.client.response.AssetInfoResponse;
import xyz.xtt.asset.client.response.AssetNoResponse;
import xyz.xtt.asset.client.response.AssetStaticResponse;
import xyz.xtt.asset.client.response.AssetTransactionResponse;
import xyz.xtt.asset.client.response.AssetUserLogResponse;
import xyz.xtt.asset.client.response.AssetVo;
import xyz.xtt.asset.client.response.BlindBoxDetailResponse;
import xyz.xtt.asset.client.response.CancelOrderResponse;
import xyz.xtt.asset.client.response.ConfirmOrderResponse;
import xyz.xtt.asset.client.response.MintResponse;
import xyz.xtt.asset.client.response.NftListVo;
import xyz.xtt.asset.client.response.TblAssetCardDto;
import xyz.xtt.asset.client.response.TblAssetExpandDto;
import xyz.xtt.asset.client.response.TblAssetNoDto;
import xyz.xtt.asset.client.response.TransactionResponse;
import xyz.xtt.asset.client.response.TransferFromResponse;
import xyz.xtt.common.response.ApiResult;

@Slf4j
@Component
public class AssetClientFallbackFactory implements FallbackFactory<AssetClient> {
	@Override
	public AssetClient create(Throwable throwable) {
		return new AssetClient() {

//			@Override
//			public ApiResult<Boolean> deliver(DeliverRequest deliverRequest) {
//				log.info("deliver FallbackFactory param: {}", JSONUtil.toJsonStr(deliverRequest));
//				return ApiResult.failure();
//			}

			@Override
			public ApiResult<MintResponse> create(String uid, @Valid MintRequest mintRequest) {
				log.info("create FallbackFactory param: {}", JSONUtil.toJsonStr(mintRequest));
				return ApiResult.failure();
			}

			@Override
			public ApiResult<MintResponse> mint(String uid, MintRequest mintRequest) {
				log.info("mint FallbackFactory param: {}", JSONUtil.toJsonStr(mintRequest));
				return ApiResult.failure();
			}

			@Override
			public ApiResult<TransferFromResponse> transferFrom(String uid, TransferFromRequest transferFromRequest) {
				log.info("mint FallbackFactory param: {}", JSONUtil.toJsonStr(transferFromRequest));
				return ApiResult.failure();
			}

//			@Override
//			public ApiResult<List<TblPayOrderDto>> fetchUnPaidOrders(FetchUnPaidOrdersRequest fetchRequest) {
//				log.info("fetchUnPaidOrders FallbackFactory param: {}", JSONUtil.toJsonStr(fetchRequest));
//				return ApiResult.failure();
//			}

//			@Override
//			public ApiResult<Boolean> confirmPayStatus(ConfirmPayOrderRequest confirmRequest) {
//				log.info("confirmPayStatus FallbackFactory param: {}", JSONUtil.toJsonStr(confirmRequest));
//				return ApiResult.failure();
//			}
//
//			@Override
//			public ApiResult<Integer> getPayStatus(GetPayStatusRequest request) {
//				log.info("getPayStatus FallbackFactory param: {}", JSONUtil.toJsonStr(request));
//				return ApiResult.failure();
//			}
//
//			@Override
//			public ApiResult<Map<Long, Integer>> getPayStatusMap(GetPayStatusMapRequest request) {
//				log.info("getPayStatusMap FallbackFactory param: {}", JSONUtil.toJsonStr(request));
//				return ApiResult.failure();
//			}

			@Override
			public ApiResult<Map<Long, Long>> collectionStatis() {
				log.info("collectionStatis FallbackFactory ");
				return ApiResult.failure();
			}

//			@Override
//			public ApiResult<Map<Long, Long>> roseStatis() {
//				log.info("roseStatis FallbackFactory ");
//				return ApiResult.failure();
//			}

//			@Override
//			public ApiResult<Boolean> assistantMessage(AssistantMessageRequest request) {
//				log.info("assistantMessage FallbackFactory");
//				return ApiResult.failure();
//			}

//			@Override
//			public ApiResult<TblPayOrderDto> fetchPayOrder(Long payOrderId) {
//				log.info("fetchPayOrder FallbackFactory param: {}", payOrderId);
//				return ApiResult.failure();
//			}

			@Override
			public ApiResult<List<TblAssetCardDto>> getUserCardInfo(CardInfoRequest cardInfoRequest) {
				log.info("fetchPayOrder getUserCardInfo param: {}", cardInfoRequest);
				return ApiResult.failure();
			}

//			@Override
//			public ApiResult<List<BusinessOrderDto>> selectListByGoodsIds(BusinessOrderRequest businessOrderRequest) {
//				log.info("fetchPayOrder selectListByGoodsIds param: {}", businessOrderRequest);
//				return ApiResult.failure();
//			}

//			@Override
//			public ApiResult<Map<Long, BusinessOrderDto>> getBusinessListByIds(Set<Long> ids) {
//				log.info("fetchPayOrder getBusinessListByIds param: {}", ids);
//				return ApiResult.failure();
//			}

//			@Override
//			public ApiResult<List<TblUserFundRecordDto>> getNeedSettleRecords(Integer maxCount, Long lastId) {
//				log.info("getNeedSettleRecords FallbackFactory param: {},{}", maxCount, lastId);
//				return ApiResult.failure();
//			}
//
//			@Override
//			public ApiResult<Boolean> updateFundSettled(UpdateFundSettledRequest request) {
//				log.info("updateFundSettled FallbackFactory param: {}", JSONUtil.toJsonStr(request));
//				return ApiResult.failure();
//			}

			@Override
			public ApiResult<AssetInfoResponse> infoWithAssetId(Long assetId) {
				log.info("infoWithAssetId FallbackFactory goodsId: {}", assetId);
				return ApiResult.failure();
			}

			@Override
			public ApiResult<AssetExtInfoResponse> extInfoWithAssetId(Long assetId) {
				log.info("extInfoWithAssetId FallbackFactory goodsId: {}", assetId);
				return ApiResult.failure();
			}

			@Override
			public ApiResult<AssetStaticResponse> staticInfoWithAssetId(Long assetId) {
				log.info("staticInfoWithAssetId FallbackFactory goodsId: {}", assetId);
				return ApiResult.failure();
			}

			@Override
			public ApiResult<AssetAllInfoResponse> infoAssetId(Long assetId) {
				log.info("infoAssetId FallbackFactory assetId: {}", assetId);
				return ApiResult.failure();
			}

			@Override
			public ApiResult<List<NftListVo>> index(Long uid, Integer type, Integer currPage, Integer pageSize, String sortType, String sortOrder) {
				log
						.info("index FallbackFactory uid:{}, type:{},currPage:{},pageSize:{},sortType:{},sortOrder:{}", uid, type, currPage, pageSize, sortType, sortOrder);
				return ApiResult.failure();
			}

			@Override
			public ApiResult<AssetAllInfoResponse> infoGoodsId(String goodsId) {
				log.info("infoGoodsId FallbackFactory assetId: {}", goodsId);
				return ApiResult.failure();
			}

			@Override
			public ApiResult<AssetAccountResponse> accountInfoCheckAmount(Long assetId, Long appUid) {
				log.info("accountInfoCheckAmount FallbackFactory assetId:{},uid:{}", assetId, appUid, appUid);
				return ApiResult.failure();
			}

			@Override
			public ApiResult<AssetAccountResponse> accountInfoUnCheckAmount(Long assetId, Long appUid) {
				log.info("accountInfoUnCheckAmount FallbackFactory assetId:{},uid:{}", assetId, appUid, appUid);
				return ApiResult.failure();
			}

			@Override
			public ApiResult<TransactionResponse> queryNotPaiedPersonalMintUpChaninOrder(Long assetId, String appUid) {
				log.info("queryNotPaiedPersonalMintUpChaninOrder FallbackFactory assetId:{},uid:{}", assetId, appUid);
				return ApiResult.failure();
			}

			@Override
			public ApiResult<BigDecimal> buyMaxPriceWithHistory(String appUid, String goodsId) {
				log.info("buyMaxPriceWithHistory FallbackFactory goodsId:{},uid:{}", goodsId, appUid);
				return ApiResult.failure();
			}

			@Override
			public ApiResult<AssetGroupResponse> group(Long assetId) {
				log.info("group FallbackFactory assetId:{}", assetId);
				return ApiResult.failure();
			}

			@Override
			public ApiResult<Long> queryPutOn(String uid) {
				log.info("queryPutOn FallbackFactory uid:{}", uid);
				return ApiResult.failure();
			}

			@Override
			public ApiResult<AssetTransactionResponse> makeTransaction(@Valid MakeTransactionRequest makeOrder) {
				log.info("makeTransaction FallbackFactory makeOrder:{}", JSONUtil.toJsonStr(makeOrder));
				return ApiResult.failure();
			}

			@Override
			public ApiResult<CancelOrderResponse> cancelTransaction(@Valid CancelTransactionRequest cancelTransactionRequest) {
				log.info("cancelTransactionRequest FallbackFactory makeOrder:{}", JSONUtil.toJsonStr(cancelTransactionRequest));
				return ApiResult.failure();
			}

			@Override
			public ApiResult<ConfirmOrderResponse> confirmTransaction(@Valid ConfirmTransactionRequest confirmTransactionRequest) {
				log.info("confirmTransactionRequest FallbackFactory makeOrder:{}", JSONUtil.toJsonStr(confirmTransactionRequest));
				return ApiResult.failure();
			}

			@Override
			public ApiResult<Boolean> hasGift365(Long appUid) {
				log.info("hasGift365 FallbackFactory appUid:{}", appUid);
				return ApiResult.failure();
			}

			@Override
			public ApiResult<AssetInfoResponse> infoWithGoodsId(String goodsId) {
				log.info("infoWithGoodsId FallbackFactory goodsId:{}", goodsId);
				return ApiResult.failure();
			}

			@Override
			public ApiResult<TransactionResponse> queryNotPayOrder(Long assetId, String appUid) {
				log.info("queryNotPayOrder FallbackFactory assetId:{},appUid:{}", assetId, appUid);
				return ApiResult.failure();
			}

			@Override
			public ApiResult<TransactionResponse> queryPaySyncOne(String buyUserId, Long orderId) {
				log.info("queryPaySyncOne FallbackFactory buyUserId:{},orderId:{}", buyUserId, orderId);
				return ApiResult.failure();
			}

			@Override
			public ApiResult<TblAssetExpandDto> getAssetExpand(@NotNull Long assetId) {
				log.info("getAssetExpand FallbackFactory assetId:{}", assetId);
				return ApiResult.failure();
			}

			@Override
			public ApiResult<TransactionResponse> transactionInfo(Long orderId) {
				log.info("transactionInfo FallbackFactory orderId:{}", orderId);
				return ApiResult.failure();
			}

			@Override
			public ApiResult<Map<String, AssetAllInfoResponse>> batchInfoGoodsIds(Collection<String> goodsIds) {
				log.info("batchInfoGoodsIds FallbackFactory goodsIds:{}", JSONUtil.toJsonStr(goodsIds));
				return ApiResult.failure();
			}

			@Override
			public ApiResult<Map<Long, AssetAllInfoResponse>> batchInfoAssetId(Collection<Long> assetIds) {
				log.info("batchInfoAssetId FallbackFactory assetIds:{}", JSONUtil.toJsonStr(assetIds));
				return ApiResult.failure();
			}

			@Override
			public ApiResult<List<AssetVo>> queryAssetType(Integer currPage, String uid, AssetTypeEnum type) {
				log.info("queryAssetType FallbackFactory currPage:{},uid:{},type:{}", currPage, uid, type);
				return ApiResult.failure();
			}

			@Override
			public ApiResult<List<BlindBoxDetailResponse>> queryBlindBoxDetail(List<String> goodsId) {
				log.info("queryBlindBoxDetail FallbackFactory goodsId:{}", JSONUtil.toJsonStr(goodsId));
				return ApiResult.failure();
			}

			@Override
			public ApiResult<AssetUserLogResponse> lastConfig(Long assetId) {
				log.info("lastConfig FallbackFactory assetId:{}", assetId);
				return ApiResult.failure();
			}

			@Override
			public ApiResult<Boolean> saveUpChainFlag(String appUid, Long businessRefId) {
				log.info("saveUpChainFlag FallbackFactory appUid:{},businessRefId:{}", appUid, businessRefId);
				return ApiResult.failure();
			}

			@Override
			public ApiResult<Boolean> adjustPopularityRate(String goodsId, int targetValue) {
				log.info("adjustPopularityRate FallbackFactory adjustPopularityRate:{},targetValue:{}", goodsId, targetValue);
				return ApiResult.failure();
			}

			@Override
			public ApiResult<MintResponse> thirdOrder(ThirdOrderRequest payOrderDto) {
				log.info("thirdOrder FallbackFactory thirdOrder:{}", JSONUtil.toJsonStr(payOrderDto));
				return ApiResult.failure();
			}

			@Override
			public ApiResult<Boolean> deliver(DeliverRequest deliverRequest) {
				log.info("deliver FallbackFactory deliverRequest:{}", JSONUtil.toJsonStr(deliverRequest));
				return ApiResult.failure();
			}

			@Override
			public ApiResult<List<TblAssetNoDto>> getNFTNoInfo(AssetNoInfoRequest assetNoInfoRequest) {
				log.info("getNFTNoInfo FallbackFactory assetNoInfoRequest:{}", JSONUtil.toJsonStr(assetNoInfoRequest));
				return ApiResult.failure();
			}

			@Override
			public ApiResult<AssetAccountResponse> accountInfoWithId(Long accountId) {
				log.info("accountInfoWithId FallbackFactory accountId:{}", accountId);
				return ApiResult.failure();
			}

			@Override
			public ApiResult<AssetNoResponse> assetNoInfoWithNoId(Long NoId) {
				log.info("assetNoInfoWithNoId FallbackFactory NoId:{}", NoId);
				return ApiResult.failure();
			}

			@Override
			public ApiResult<AssetDetailInfo> detailInfo(String uid, String goodsId, Long accountId) {
				log.info("detailInfo FallbackFactory uid:{},goodsId:{},accountId:{}", uid, goodsId, accountId);
				return ApiResult.failure();
			}

		};
	}
}
